package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TbShopcartMapper;
import com.ruoyi.system.domain.TbShopcart;
import com.ruoyi.system.service.ITbShopcartService;

/**
 * 购物车信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-06-16
 */
@Service
public class TbShopcartServiceImpl implements ITbShopcartService 
{
    @Autowired
    private TbShopcartMapper tbShopcartMapper;

    /**
     * 查询购物车信息
     * 
     * @param scId 购物车信息主键
     * @return 购物车信息
     */
    @Override
    public TbShopcart selectTbShopcartByScId(Long scId)
    {
        return tbShopcartMapper.selectTbShopcartByScId(scId);
    }

    /**
     * 查询购物车信息列表
     * 
     * @param tbShopcart 购物车信息
     * @return 购物车信息
     */
    @Override
    public List<TbShopcart> selectTbShopcartList(TbShopcart tbShopcart)
    {
        return tbShopcartMapper.selectTbShopcartList(tbShopcart);
    }

    /**
     * 新增购物车信息
     * 
     * @param tbShopcart 购物车信息
     * @return 结果
     */
    @Override
    public int insertTbShopcart(TbShopcart tbShopcart)
    {
        tbShopcart.setCreateTime(DateUtils.getNowDate());
        tbShopcart.setUserId(SecurityUtils.getUserId());
        return tbShopcartMapper.insertTbShopcart(tbShopcart);
    }

    /**
     * 修改购物车信息
     * 
     * @param tbShopcart 购物车信息
     * @return 结果
     */
    @Override
    public int updateTbShopcart(TbShopcart tbShopcart)
    {
        return tbShopcartMapper.updateTbShopcart(tbShopcart);
    }

    /**
     * 批量删除购物车信息
     * 
     * @param scIds 需要删除的购物车信息主键
     * @return 结果
     */
    @Override
    public int deleteTbShopcartByScIds(Long[] scIds)
    {
        return tbShopcartMapper.deleteTbShopcartByScIds(scIds);
    }

    /**
     * 删除购物车信息信息
     * 
     * @param scId 购物车信息主键
     * @return 结果
     */
    @Override
    public int deleteTbShopcartByScId(Long scId)
    {
        return tbShopcartMapper.deleteTbShopcartByScId(scId);
    }
}
